home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / drivers / char / atari_MFPser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-08  |  3.0 KB  |  125 lines

  1.  
  2. /*
  3.  * atari_MFPser.h: Definitions for MFP serial ports
  4.  *
  5.  * Copyright 1994 Roman Hodek
  6.  *   EMail: rnhodek@cip.informatik.uni-erlangen.de (Internet)
  7.  *      or: Roman_Hodek@n.maus.de (MausNet, NO mail > 16 KB!)
  8.  *
  9.  * This file is subject to the terms and conditions of the GNU General Public
  10.  * License.  See the file README.legal in the main directory of this archive
  11.  * for more details.
  12.  *
  13.  */
  14.  
  15.  
  16. #ifndef _ATARI_MFPSER_H
  17. #define _ATARI_MFPSER_H
  18.  
  19.  
  20. #define    currMFP(info)    ((volatile struct MFP *)(info->base))
  21.  
  22. /* MFP input frequency, divided by 16 (USART prediv for async modes)
  23.  * and 2 because of each timer run _toggles_ the output, resulting in
  24.  * half the frequency, and 2 as greatest common divisor of all timer
  25.  * modes.
  26.  */
  27. #define    MFP_BAUD_BASE    (2457600/16/2/2)
  28.  
  29. /* USART Control Register */
  30.  
  31. #define    UCR_PARITY_MASK        0x06
  32. #define    UCR_PARITY_OFF        0x00
  33. #define    UCR_PARITY_ODD        0x04
  34. #define    UCR_PARITY_EVEN        0x06
  35.  
  36. #define    UCR_MODE_MASK        0x18
  37. #define    UCR_SYNC_MODE        0x00
  38. #define    UCR_ASYNC_1            0x08
  39. #define    UCR_ASNYC_15        0x10
  40. #define    UCR_ASYNC_2            0x18
  41.  
  42. #define    UCR_CHSIZE_MASK        0x60
  43. #define    UCR_CHSIZE_8        0x00
  44. #define    UCR_CHSIZE_7        0x20
  45. #define    UCR_CHSIZE_6        0x40
  46. #define    UCR_CHSIZE_5        0x60
  47.  
  48. #define    UCR_PREDIV            0x80
  49.  
  50. /* Receiver Status Register */
  51.  
  52. #define    RSR_RX_ENAB            0x01
  53. #define    RSR_STRIP_SYNC        0x02
  54. #define    RSR_SYNC_IN_PRGR    0x04    /* sync mode only */
  55. #define    RSR_CHAR_IN_PRGR    0x04    /* async mode only */
  56. #define    RSR_SYNC_SEARCH        0x08    /* sync mode only */
  57. #define    RSR_BREAK_DETECT    0x08    /* async mode only */
  58. #define    RSR_FRAME_ERR        0x10
  59. #define    RSR_PARITY_ERR        0x20
  60. #define    RSR_OVERRUN_ERR        0x40
  61. #define    RSR_CHAR_AVAILABLE    0x80
  62.  
  63. /* Transmitter Status Register */
  64.  
  65. #define    TSR_TX_ENAB            0x01
  66.  
  67. #define    TSR_SOMODE_MASK        0x06
  68. #define    TSR_SOMODE_OPEN        0x00
  69. #define    TSR_SOMODE_LOW        0x02
  70. #define    TSR_SOMODE_HIGH        0x04
  71. #define    TSR_SOMODE_LOOP        0x06
  72.  
  73. #define    TSR_SEND_BREAK        0x08
  74. #define    TSR_LAST_BYTE_SENT    0x10
  75. #define    TSR_HALF_DUPLEX        0x20
  76. #define    TSR_UNDERRUN        0x40
  77. #define    TSR_BUF_EMPTY        0x80
  78.  
  79. /* Control signals in the GPIP */
  80.  
  81. #define    GPIP_DCD            0x02
  82. #define    GPIP_CTS            0x04
  83. #define    GPIP_RI                0x40
  84.  
  85.  
  86. /* Convenience routine to access RTS and DTR in the Soundchip: It sets
  87.  * the register to (oldvalue & mask) if mask is negative or (oldvalue
  88.  * | mask) if positive. It returns the old value. I guess the
  89.  * parameters will be constants most of the time, so gcc can throw
  90.  * away the if statement if it isn't needed.
  91.  */
  92.  
  93. static __inline__ unsigned char GIACCESS( int mask )
  94.  
  95. {    unsigned char    old;
  96.     
  97.     sound_ym.rd_data_reg_sel = 14;
  98.     old = sound_ym.rd_data_reg_sel;
  99.  
  100.     if (mask) {
  101.         if (mask < 0)
  102.             sound_ym.wd_data = old & mask;
  103.         else
  104.             sound_ym.wd_data = old | mask;
  105.     }
  106.     
  107.     return( old );
  108. }
  109.  
  110. #define    GI_RTS                0x08
  111. #define    GI_DTR                0x10
  112.  
  113. #define    MFPser_RTSon()        GIACCESS( ~GI_RTS )
  114. #define    MFPser_RTSoff()        GIACCESS( GI_RTS )
  115. #define    MFPser_DTRon()        GIACCESS( ~GI_DTR )
  116. #define    MFPser_DTRoff()        GIACCESS( GI_DTR )
  117.  
  118.  
  119. void atari_init_MFPser( struct async_struct *info, SERTYPE type,
  120.                         int tt_flag, void *ri_addr,
  121.                         unsigned char ri_bitno, unsigned char ri_active );
  122.  
  123.  
  124. #endif /* _ATARI_MFPSER_H */
  125.